package com.bw.zg3park2212.adpter

import android.widget.TextView
import com.bw.base.entity.RepairEntityItem
import com.bw.zg3park2212.R
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder

class RepairAdpter:BaseQuickAdapter<RepairEntityItem,BaseViewHolder>(R.layout.item_repair) {
    override fun convert(helper: BaseViewHolder, item: RepairEntityItem) {
        helper.setText(R.id.repair_Num,"工单号:"+item.orderNumber)
        helper.setText(R.id.repair_status,item.processingStatus)
        helper.setText(R.id.repair_time,"报修时间:"+item.repairTime)
        helper.setText(R.id.repair_user,"报修人:"+item.repairName)
        helper.setText(R.id.repair_phone,"报修电话:"+item.contactMethod.toString())
        helper.setText(R.id.repair_location,"位置:"+item.repairLocation)
        helper.setText(R.id.repair_desc,"故障描述:"+item.faultDescription)
        val tv_status = helper.getView<TextView>(R.id.repair_status)
        if(item.processingStatus=="已完成"){
            tv_status.setTextColor(context.getColor(R.color.color_kongxian))
            tv_status.setBackgroundResource(R.drawable.bg_kongxian)
        }else if (item.processingStatus=="处理中"){
            tv_status.setTextColor(context.getColor(R.color.color_zhanyong))
            tv_status.setBackgroundResource(R.drawable.bg_zganyong)
        }else{
            tv_status.setTextColor(context.getColor(R.color.color_weihu))
            tv_status.setBackgroundResource(R.drawable.bg_weihu)
        }
    }
}